<?php

namespace Modules\Shop\Entities;

use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
//    protected $fillable = [''];
//    protected $guarded = [];
    protected $fillable = ['title','author','content','thumb','click','iscommend','category_id','summary'];

//    定义模型关联关联方法
    public function moxin(){
        return $this->belongsTo(Category::class,'category_id','id');
    }

//    定义文章表对评论表的模型关联方法
    public function xm(){
        return $this->hasMany(Comment::class,'article_id','id');
    }
}
